<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui">
<h:head></h:head>
<h:body>
<ui:composition template="/templates/Plantilla.xhtml">
<ui:define name="content">
	<h:form id="form">
	<h3> Gestión de Pack</h3>
	<p:separator/>
	<p:growl id="growl1" />
	<p:dataTable  id="tblPack" value="#{packList.listadoDePack}" var="p"
                                paginator="true" rows="10">
                                
		<f:facet name="header">Listados de Packs</f:facet>  					 
		<p:column>
			<f:facet name="header">
				<h:commandButton 
					image="#{resource['images:plus-16-ns.png']}" title ="Nuevo Pack" 
					action="#{packList.nuevoPack}">			  
				</h:commandButton>
			</f:facet>
			
			<h:commandButton type="submit" action="#{packList.prepareEdit(p)}" 
				image="#{resource['images:pencil-16-ns.png']}" title ="Modificar Pack">
			</h:commandButton>
  							    				
  		</p:column>
  			
		<p:column id="nombrePack">  			
  				<f:facet name="header">Nombre Pack</f:facet>
  				#{p.nombre}			    			
 		</p:column>

		<p:column>
  				<f:facet name="header">Precio</f:facet>
  				#{p.precioPack}
		</p:column>

		<p:column>
  				<f:facet name="header">Producto</f:facet>
  				#{p.producto.nombre}
		</p:column>
		
		<p:column>
  				<f:facet name="header">Descripcion</f:facet>
  				#{p.descripcion}
		</p:column>
		<p:column>
			<p:commandLink onclick="dlg2.show()" title="Eliminar Pack" actionListener="#{packList.bajaListener(p)}" >
  					<p:graphicImage value="#{resource['images:cross-16-ns.png']}"/>
  			</p:commandLink>
		</p:column>
		
	</p:dataTable>
	<p:dialog id="modalDialog" header="Eliminacion de Registro" widgetVar="dlg2" modal="true" resizable="false">  
    	
		<h:outputLabel value="¿Desea Eliminar un Pack?" />
    	<br></br>
    	<br></br>
		<p:panel>
			<p:commandButton id="confirm" value="Si" oncomplete="dlg2.hide()"  
                    actionListener="#{packList.eliminarPack()}" update="tblPack" ajax="false"/>  
       		<p:commandButton id="decline" value="No" onclick="dlg2.hide()" type="button" ajax="false" />
		</p:panel>
	</p:dialog>
	</h:form>
</ui:define>
</ui:composition>
</h:body>
</html>